$(function () {
    $(".nav li").bind("click", function () {
        $(this).addClass("active").siblings().removeClass("active");
        if ($(this).attr("data-type") == 1) {
            $(".one").css("display", "block").siblings().css("display", "none");
        }
        if ($(this).attr("data-type") == 2) {
            $(".two").css("display", "block").siblings().css("display", "none");
        } if ($(this).attr("data-type") == 3) {
            $(".three").css("display", "block").siblings().css("display", "none");
        } if ($(this).attr("data-type") == 4) {
            $(".fore").css("display", "block").siblings().css("display", "none");
        }
    })
    $(".tijiao-xiugai button").bind("click", function () {
        var passwordone = $("#passwordone").val(),
            password = $("#Pass").val();
        $.ajax({
            url: '/xiugaiAccount',
            type: 'POST',
            data: {
                'password': password,
            },
            beforeSend: function (formData, jqForm, options) {
                if (passwordone == password & password.length >= 6) {
                    return true;
                }
                else if (password.length < 6 || passwordone.length < 6) {
                    alert("密码不能少于6位");
                    $("#passwordone").val("").focus();
                    $("#Pass").val("");
                    return false;
                }
                else if (passwordone != password) {
                    alert("两次密码不相等");
                    $("#passwordone").val("").focus();
                    $("#Pass").val("");
                    return false;
                }
                alertwin("未知错误","服务器异常！！");
                return false;
            },
            success: function (responseText, statusText) {
                if (responseText == "ok") {
                    alert("修改成功，请重新登录");
                    window.location.href = "/Logn/Index";
                }
                else {
                    alert("修改失败，请重试！！");
                    $("#passwordone").val(""),
                     $("#Pass").val("");
                }
            },
            error: function (event, errorText, errorType) {
                alert("运气不好吧 服务器繁忙，请重试！！");
            },
        });

    })

    function alertwin(tilele, content) {
        $.alert({
            title: tilele,
            content: content,
            confirmButton: '确认',
            columnClass: 'col-md-4 col-md-offset-4',

        });
    }
    $("#input-4").fileinput({
        language: "zh",
        uploadAsync: false,
    })
})